class Groupaction < ActiveRecord::Base

	def self.compareCtlToDb(hCtl)
		gacts = Groupaction.find(:all)
		# counting all action in hCtl
		cnt = 0
		hCtl.each{|ctl, hAct|
			hAct.each{|act, val|
				cnt = cnt+1
			}
		}
		 if gacts.length != cnt then
		 	return false ,"There are #{gacts.length} records in database and #{cnt} in controller"
		 end
		gacts.each{|gact|
			return false if hCtl[gact.controller].nil?
			return false if hCtl[gact.controller][gact.action].nil?
		}
		return true
	end
end
